# import h5py
# #（1）HDF5的读取：
# #打印输出
# filename='HDF5_FILE.h5'
# f = h5py.File(filename,'r') #打开h5文件
# # 可以查看所有的主键
# for key in f.keys():
#     print(f[key].name)
#     print(f[key].shape)
#     print(f[key].value)

#（2）h5文件转换为csv文件
import pandas as pd
import numpy as np

path = r'Path\meta.h5'
path_to = r'Path\result.csv'  # 写入csv

h5_store = pd.HDFStore(path, mode='r+')  # 创建新的对象、读入已存在的对象
a = h5_store.keys()
df = h5_store.get('key_1')
df.to_csv(path_to)
h5_store.close()
